#pragma warning(disable:4819)
#pragma once
#include <memory>
#include <SDL.h>
#include <array>
#include "Object.h"

using Texture = std::pair<SDL_Texture*, SDL_Rect>;

class TextureLoader
{
public:
    static TextureLoader& Instance();
    ~TextureLoader();
    Texture GetEnemyTexture(Angle angle, EnemyType type, bool index, bool light = false);
    Texture GetPlayer1Texture(Angle angle, int level, bool index);
    Texture GetPlayer2Texture(Angle angle, int level, bool index);
    Texture GetBulletTexture(Angle angle);
    SDL_Texture* GetTerrainTexture(TerrainType type) const;
    Texture GetExplosionTexture(uint32_t current_frame) const;
    Texture GetGenEnemyAnimationTexture(uint32_t current_frame);
private:
    TextureLoader();
    TextureLoader(const TextureLoader&) = delete;
    TextureLoader& operator=(const TextureLoader&) = delete;
    SDL_Texture* source_;
    std::array<SDL_Rect,4> bulletSrcRects_;
    std::array<SDL_Texture*,TerrainType::TerrainTypeNum> terrainTextures_;  //地形贴图
    std::array<SDL_Rect, 5> explosionTextures_;   //爆炸动画贴图
};